home *** CD-ROM | disk | FTP | other *** search
- Path: solon.com!not-for-mail
- From: seebs@solutions.solon.com (Peter Seebach)
- Newsgroups: comp.lang.c
- Subject: Re: Problem Negating an Unsigned Char
- Date: 4 Mar 1996 01:17:52 -0600
- Organization: Usenet Fact Police (Undercover)
- Message-ID: <4he5f0$acv@solutions.solon.com>
- References: <Dnnros.Lq.0.-s@hkusuc.hku.hk> <4he27sINNdel@keats.ugrad.cs.ubc.ca>
- NNTP-Posting-Host: solutions.solon.com
-
- In article <4he27sINNdel@keats.ugrad.cs.ubc.ca>,
- Kazimir Kylheku <c2a192@ugrad.cs.ubc.ca> wrote:
- >To make it portable, you must manually mask for the lower eight bits:
-
- > if (a == (~b & 0xff))
-
- Close, but the cigar yet escapes you.
-
- if (a == (~b & ((1 << CHAR_BIT) - 1)))
-
- Further, you can't do this portably; if sizeof(long) is 1, the
- shift is illegal.
-
- You could add ifdefs for this; enjoy!
-
- -s
- --
- Peter Seebach - seebs@solon.com - Copyright 1996 Peter Seebach.
- C/Unix wizard -- C/Unix questions? Send mail for help. No, really!
- FUCK the communications decency act. Goddamned government. [literally.]
- The *other* C FAQ - http://www.solon.com/~seebs/c/c-iaq.html
-